<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>&lt;&lt;</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="Zerodbfs.html" title="0dbfs" />
    <link rel="next" href="opbitshr.html" title="&gt;&gt;" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">&lt;&lt;</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="Zerodbfs.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="opbitshr.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="opbitshl"></a>
      <div class="titlepage"></div>
      <a id="IndexShiftL" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">&lt;&lt;</span>
        </h2>
        <p>&lt;&lt; — 
      Bitshift left operator.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp88810640"></a>
        <h2>Description</h2>
        <p>
      The bitshift operators shift the bits to the left or to the right the number of bits given.
    </p>
        <p>
    The priority of these operators is less binding that the
    arithmetic ones, but more binding that the comparisons. 
    </p>
        <p>
      Parentheses may be used as above to force particular groupings.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp88812912"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">a <span class="command"><strong>&lt;&lt;</strong></span> b  (bitshift left)</pre>
        <p>
      where the arguments <span class="emphasis"><em>a</em></span> and <span class="emphasis"><em>b</em></span> may be further
    expressions.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp88816304"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the bitshift left operator. It uses the file <a class="ulink" href="examples/bitshift.csd" target="_top"><em class="citetitle">bitshift.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp88818176"></a>
          <p class="title">
            <strong>Example 36. Example of the bitshift left operator.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in</span>
<span class="comment">;-odac           -iadc    ;;;RT audio I/O</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
-o bitshift.wav -W --nosound <span class="comment">;;; for file output any platform </span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 128
<span class="ohdr">nchnls</span> <span class="op">=</span> 2

<span class="oblock">instr</span> 1 <span class="comment">;bit shift right</span>
ival <span class="op">=</span> p4<span class="op">&gt;</span><span class="op">&gt;</span>p5
<span class="opc">printf_i</span> "<span class="op">%</span><span class="opc">i</span><span class="op">&gt;</span><span class="op">&gt;</span><span class="op">%</span><span class="opc">i</span> <span class="op">=</span> <span class="op">%</span>i\n", 1, p4, p5, ival
<span class="oblock">endin</span>

<span class="oblock">instr</span> 2 <span class="comment">;bit shift left</span>
ival <span class="op">=</span> p4<span class="op">&lt;</span><span class="op">&lt;</span>p5
<span class="opc">printf_i</span> "<span class="op">%</span><span class="opc">i</span><span class="op">&lt;</span><span class="op">&lt;</span><span class="op">%</span><span class="opc">i</span> <span class="op">=</span> <span class="op">%</span>i\n", 1, p4, p5, ival
<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">i</span> 1   0   0.1  2   1
<span class="stamnt">i</span> 1   +    .   3   1
<span class="stamnt">i</span> 1   +    .   7   2
<span class="stamnt">i</span> 1   +    .   16   1
<span class="stamnt">i</span> 1   +    .   16   2
<span class="stamnt">i</span> 1   +    .   16   3

<span class="stamnt">i</span> 2   5    0.1 1   1
<span class="stamnt">i</span> 2   +    .   1   2
<span class="stamnt">i</span> 2   +    .   1   3
<span class="stamnt">i</span> 2   +    .   1   4
<span class="stamnt">i</span> 2   +    .   2   1
<span class="stamnt">i</span> 2   +    .   2   2
<span class="stamnt">i</span> 2   +    .   2   3
<span class="stamnt">i</span> 2   +    .   3   2
<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
        <p>The example above will produce the following output:
      </p>
        <div class="literallayout">
          <p>2&gt;&gt;1 = 1<br />
B  0.000 ..  0.100 T  0.100 TT  0.100 M:      0.0      0.0<br />
3&gt;&gt;1 = 1<br />
B  0.100 ..  0.200 T  0.200 TT  0.200 M:      0.0      0.0<br />
7&gt;&gt;2 = 1<br />
B  0.200 ..  0.300 T  0.300 TT  0.300 M:      0.0      0.0<br />
16&gt;&gt;1 = 8<br />
B  0.300 ..  0.400 T  0.400 TT  0.400 M:      0.0      0.0<br />
16&gt;&gt;2 = 4<br />
B  0.400 ..  0.500 T  0.500 TT  0.500 M:      0.0      0.0<br />
16&gt;&gt;3 = 2<br />
B  0.500 ..  5.000 T  5.000 TT  5.000 M:      0.0      0.0<br />
new alloc for instr 2:<br />
1&lt;&lt;1 = 2<br />
B  5.000 ..  5.100 T  5.100 TT  5.100 M:      0.0      0.0<br />
1&lt;&lt;2 = 4<br />
B  5.100 ..  5.200 T  5.200 TT  5.200 M:      0.0      0.0<br />
1&lt;&lt;3 = 8<br />
B  5.200 ..  5.300 T  5.300 TT  5.300 M:      0.0      0.0<br />
1&lt;&lt;4 = 16<br />
B  5.300 ..  5.400 T  5.400 TT  5.400 M:      0.0      0.0<br />
2&lt;&lt;1 = 4<br />
B  5.400 ..  5.500 T  5.500 TT  5.500 M:      0.0      0.0<br />
2&lt;&lt;2 = 8<br />
B  5.500 ..  5.600 T  5.600 TT  5.600 M:      0.0      0.0<br />
2&lt;&lt;3 = 16<br />
B  5.600 ..  5.700 T  5.700 TT  5.700 M:      0.0      0.0<br />
3&lt;&lt;2 = 12</p>
        </div>
        <p>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp88824752"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="opbitshr.html" title="&gt;&gt;"><em class="citetitle">&gt;&gt;</em></a>,
      <a class="link" href="opbitand.html" title="&amp;"><em class="citetitle">&amp;</em></a>,
      <a class="link" href="opbitor.html" title="|"><em class="citetitle">|</em></a>
      <a class="link" href="opnonequiv.html" title="#"><em class="citetitle">#</em></a>
    </p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="Zerodbfs.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="opbitshr.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">0dbfs </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> &gt;&gt;</td>
        </tr>
      </table>
    </div>
  </body>
</html>
